<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../lib/vue.js"></script>
</head>

<body>
    <div v-bind:class="{active: isActive}">
    </div>
    <!-- 这里的语法表示active这个class存在与否将取决于数据property isActive的truthiness -->
    <!-- 你可以在对象中传入跟多的字段来动态切换多个class 此外v-bind：class指令也可以与普通的class attribute共存 -->
    <div class="static" v-bind:class="{ active: isActive, 'text-danger': hasError }"></div>
    
    <script>
        new Vue({
            data:{
                isActive:true,
                hasError:false
            }
        })
    </script>
</body>

</html>